GtkRange: Remove recalc_marks field
authorTimm Bäder <mail@baedert.org>
Wed, 2 Dec 2015 19:43:17 +0000 (20:43 +0100)
committerTimm Bäder <mail@baedert.org>
Wed, 2 Dec 2015 20:06:11 +0000 (21:06 +0100)
And instead recalculate the marks on demand, i.e. whenever we were
previously setting recalc_marks to TRUE.

gtk/gtkrange.c

index da02ed061fc89c5dacc0ead0568a9a9fea1122bf..69aceab3d30bec86e42fbd95a0a8fc49940f708f 100644 (file)
@@ -135,7 +135,6 @@ struct _GtkRangePrivate
 
   guint flippable              : 1;
   guint inverted               : 1;
-  guint recalc_marks           : 1;
   guint slider_size_fixed      : 1;
   guint trough_click_forward   : 1;  /* trough click was on the forward side of slider */
 
@@ -1740,8 +1739,7 @@ gtk_range_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
-  priv->recalc_marks = TRUE;
-
+  gtk_range_calc_marks (range);
   gtk_range_calc_layout (range);
 
   if (gtk_widget_get_realized (widget))
@@ -1968,9 +1966,6 @@ gtk_range_draw (GtkWidget *widget,
       draw_slider = TRUE;
     }
 
-  gtk_range_calc_marks (range);
-  gtk_range_calc_layout (range);
-
   /* Just to be confusing, we draw the trough for the whole
    * range rectangle, not the trough rectangle (the trough
    * rectangle is just for hit detection)
@@ -4032,11 +4027,6 @@ gtk_range_calc_marks (GtkRange *range)
   GdkRectangle slider;
   gint i;
 
-  if (!priv->recalc_marks)
-    return;
-
-  priv->recalc_marks = FALSE;
-
   for (i = 0; i < priv->n_marks; i++)
     {
       gtk_range_compute_slider_position (range, priv->marks[i], &slider);
@@ -4202,7 +4192,7 @@ _gtk_range_set_stop_values (GtkRange *range,
   for (i = 0; i < n_values; i++) 
     priv->marks[i] = values[i];
 
-  priv->recalc_marks = TRUE;
+  gtk_range_calc_marks (range);
 }
 
 gint